home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / hack / 3_1_3 / vmsunpck.com < prev   
Encoding:
Text File  |  1993-07-24  |  4.8 KB  |  116 lines

  1. $! vmsunpack.com -- unpack NetHack's *.tar.Z.uu archive packages    [pr]
  2. $!        into individual source files, creating subdirectories
  3. $!        as needed.  The current directory must hold the input
  4. $!        packages and will become the 'top' of Nethack source tree.
  5. $!        For VMS, the input files should be named *.TAR_Z_UU.
  6. $!
  7. $! Site-specific setup--define appropriate commands for unpacking operations.
  8. $    uudecode   := $rpr:uudecode
  9. $    uncompress := $rpr:lzdcmp -b
  10. $    untar      := $rpr:tar2vms xv "!"
  11. $    tar_setup  := define/user_mode TAPE
  12. $! [Nothing below this line should need to be changed.]
  13. $!
  14. $! Operation (make sure that all archive packages are named correctly):
  15. $!    uudecode   SOMETHING.tar_Z_uu -> SOMETHING.tar_Z
  16. $!    uncompress SOMETHING.tar_Z    -> SOMETHING.tar
  17. $!    tar_setup  SOMETHING.tar      -> preparation for poor tar2vms interface
  18. $!    untar      SOMETHING.tar      -> individual files extracted from archive
  19. $!    delete SOMETHING.tar;,SOMETHING.tar_Z;
  20. $!      note: original .tar_Z_uu file kept; it should be deleted manually.
  21. $!
  22. $ ARCHIVES1="Top Dat1 Dat2 Dat3 Dat4 Doc1 Doc2 Doc3 Incl1 Incl2 Incl3 Incl4 "-
  23.        +"Util1 Util2"
  24. $ ARCHIVES2="Src1 Src2 Src3 Src4 Src5 Src6 Src7 Src8 Src9 Src10 "-
  25.        +"Src11 Src12 Src13 Src14 Src15 Src16 Src17 Src18 Src19 Src20 "-
  26.        +"Src21 Src22 Src23 Src24 Src25 Src26 Src27 Src28"
  27. $ ARCHIVES3="Amiga1 Amiga2 Amiga3 Amiga4 Amiga5 Amiga6 Amiga7 AmiSpl Atari "-
  28.        +"Mac1 Mac2 Mac3 Mac4 Mac5 Mac6 Msdos1 Msdos2 Msdos3"
  29. $ ARCHIVES4="NT Os2 Shr1 Shr2 Shr3 Snd1 Snd2 Snd3 Snd4 Snd5 Unx1 Unx2 "-
  30.        +"Vms1 Vms2 Vms3 Tty X1 X2 X3"
  31. $ all = f$edit(ARCHIVES1+" "+ARCHIVES2+" "+ARCHIVES3+" "+ARCHIVES4,"COMPRESS")
  32. $ kits = "Top   |Dat   |Doc   |Incl  |Util  |Src   |Amiga |AmiSpl|Atari |"-
  33.        + "Mac   |Msdos |NT    |Os2   |Shr   |Snd   |Unx   |Vms   |Tty   |"-
  34.        + "X     |"
  35. $ dirs = "[],[.dat],[.doc],[.include],[.util],[.src],"-
  36.        + "[.sys.amiga],[.sys.amiga.splitter],[.sys.atari],"-
  37.        + "[.sys.mac],[.sys.msdos],[.sys.winnt],[.sys.os2],"-
  38.        + "[.sys.share],[.sys.share.sounds],[.sys.unix],[.sys.vms],"-
  39.        + "[.win.tty],[.win.X11]"
  40. $! VMS can live without these:
  41. $ skippable = "Amiga |AmiSpl|Atari |Mac   |Msdos |NT    |Os2   |Snd   |"-
  42.        + "Unx   |X     |"
  43. $!
  44. $ if f$parse("[.sys]").eqs."" then  create/dir [.sys]/log
  45. $ if f$parse("[.win]").eqs."" then  create/dir [.win]/log
  46. $!
  47. $! First handle some miscellaneous files --what a nuisance :-(
  48. $ if f$search("shr.termcap_uu").nes.""
  49. $ then    if f$parse("[.sys.share]").eqs."" then  create/dir [.sys.share]/log
  50. $    rename/new_vers shr.termcap_uu [.sys.share]termcap.uu
  51. $ endif
  52. $ if f$search("mac.*_hqx").nes.""
  53. $ then    if f$parse("[.sys.mac]").eqs."" then  create/dir [.sys.mac]/log
  54. $    if f$search("mac.nhproj_hqx").nes."" then -
  55.     rename/new_vers mac.nhproj_hqx [.sys.mac]NHproj.hqx
  56. $    if f$search("mac.nhsound_hqx").nes."" then -
  57.     rename/new_vers mac.nhsound_hqx [.sys.mac]NHsound.hqx
  58. $ endif
  59. $ if f$search("cpp%.shr").nes.""
  60. $ then    if f$parse("[.sys.unix]").eqs."" then  create/dir [.sys.unix]/log
  61. $    rename/new_vers cpp%.shr [.sys.unix]*.*
  62. $ endif
  63. $! [note: the above files aren't needed for the VMS port.]
  64. $!
  65. $ topdir = f$directory()
  66. $ kitsiz = f$length(f$element(0,"|",kits))+1
  67. $ kits = "|" + f$edit(kits,"UPCASE")
  68. $ k = 0 !count of archive files skipped
  69. $ i = 0 !loop index for archive substring
  70. $loop:
  71. $    f = f$element(i," ",all)
  72. $    if f.eqs."" .or. f.eqs." " then  goto done
  73. $    d = f - "0" - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" -
  74.           - "0" - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9"
  75. $   if f$search("''f'.tar").nes."" then  goto detar
  76. $   if f$search("''f'.tar_Z").nes."" then  goto decompress
  77. $   if f$search("''f'.tar_Z_uu").nes."" then -
  78.     uudecode 'f'.tar_Z_uu 'f'.tar_Z
  79. $decompress:
  80. $   if f$search("''f'.tar_Z").nes."" then -
  81.     uncompress 'f'.tar_Z 'f'.tar
  82. $   if f$search("''f'.tar").nes."" then  goto detar
  83. $!
  84. $!     an expected file wasn't found--that's OK in _some_ instances
  85. $    msg_fmt = "!/ Missing archive file !AS skipped.!/"
  86. $    if f$locate("|"+d,"|"+skippable).ge.f$length(skippable) then -
  87.         msg_fmt = "!/% Expected archive file !AS is missing!!!/"
  88. $    write sys$output f$fao(msg_fmt,"''f'.tar_Z_uu")
  89. $    k = k + 1
  90. $    goto skip
  91. $!
  92. $detar:
  93. $    p = f$locate(f$edit("|"+d,"UPCASE"),kits) / kitsiz
  94. $    d = f$element(p,",",dirs)
  95. $    set default 'd'
  96. $    if f$parse("[]").eqs."" then  create/dir []/log
  97. $    write sys$output "Unpacking ''f'.tar into ''d'..."
  98. $    f = topdir + f
  99. $    tar_setup 'f'.tar    !define/user TAPE 'f'.tar
  100. $    untar 'f'.tar        !tar2vms xv
  101. $!
  102. $    if f$search("''f'.tar_Z_uu").nes."" -
  103.      .or. f$search("''f'.tar_Z").nes."" then  delete 'f'.tar;
  104. $    if f$search("''f'.tar_Z_uu").nes."" -
  105.     .and. f$search("''f'.tar_Z").nes."" then  delete 'f'.tar_Z;
  106. $    set default 'topdir'
  107. $skip:
  108. $    i = i + 1
  109. $    goto loop
  110. $done:
  111. $    msg_fmt = "!/ Unpacking completed."
  112. $    if k.gt.0 then -
  113.         msg_fmt = msg_fmt + "  !SL archive package!%S skipped.!/"
  114. $    write sys$output f$fao(msg_fmt,k)
  115. $ exit
  116.